package com.kehutong.flow.entity;

import com.kehutong.flow.enums.FlowAction;
import com.kehutong.flow.enums.Target;
import com.kehutong.flow.enums.TimeUnit;
import org.coraframework.json.JSONArray;
import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;
import org.coraframework.orm.annotation.Table;
import org.coraframework.orm.annotation.UnSave;

import java.util.List;

/**
 * 流程节点规则
 *
 */
@Table(value="t_flow_rule_node", comment="流程节点规则", multi=true)
public class FlowRuleNode extends Entity {

    private static final long serialVersionUID = 195788389286860685L;

    protected FlowRuleNode(String id) {
        super(id);
    }
    
    @Column(comment="流程编号")
    private String flowNo;
    
    @Column(comment = "工作流事件")
    private FlowAction action;
    
    @Column(comment = "等待时间")
    private int waitTime;
    
    @Column(comment = "时间单位")
	private TimeUnit unit;

	@Column(comment = "目标类型")
	private Target target;

	@Column(comment = "目标编号")
	private String targetNo;

	@Column(comment = "目标名称")
	private String targetName;

	@Column(comment = "部门编号")
	private List<String> departmentNos;
    
    @Column(length = 127, comment = "发送内容")
    private String content;

	@Column(comment="是否拥有转单的权限")
	private boolean permissions;

	@UnSave
	private JSONArray departments;

	@UnSave
	private List<String> departmentName;

	public String getFlowNo() {
		return flowNo;
	}

	public void setFlowNo(String flowNo) {
		this.flowNo = flowNo;
	}

	public FlowAction getAction() {
		return action;
	}

	public void setAction(FlowAction action) {
		this.action = action;
	}

	public int getWaitTime() {
		return waitTime;
	}

	public void setWaitTime(int waitTime) {
		this.waitTime = waitTime;
	}

	public TimeUnit getUnit() {
		return unit;
	}

	public void setUnit(TimeUnit unit) {
		this.unit = unit;
	}

	public Target getTarget() {
		return target;
	}

	public void setTarget(Target target) {
		this.target = target;
	}

	public String getTargetNo() {
		return targetNo;
	}

	public void setTargetNo(String targetNo) {
		this.targetNo = targetNo;
	}
	
	public String getTargetName() {
		return targetName;
	}

	public void setTargetName(String targetName) {
		this.targetName = targetName;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public boolean isPermissions() {
		return permissions;
	}

	public void setPermissions(boolean permissions) {
		this.permissions = permissions;
	}

	public JSONArray getDepartments() {
		return departments;
	}

	public void setDepartments(JSONArray departments) {
		this.departments = departments;
	}

	public List<String> getDepartmentNos() {
		return departmentNos;
	}

	public void setDepartmentNos(List<String> departmentNos) {
		this.departmentNos = departmentNos;
	}

	public List<String> getDepartmentName() {
		return departmentName;
	}

	public void setDepartmentName(List<String> departmentName) {
		this.departmentName = departmentName;
	}
}
